/*
使用mockjs提供mock数据接口
 */
import Mock from 'mockjs'
import data from './data.json'

// my data :发布时 const isMock = false , dev: true
const isMock = true

if (isMock) {
  const BASE_URL = 'http://localhost:4001'
  // user
  Mock.mock(BASE_URL + '/api_app/api/v1/user/login-pwd', data.user_login_pwd)
  Mock.mock(BASE_URL + '/api_app/api/v1/user/login-sms', data.user_login_pwd)
  Mock.mock(BASE_URL + '/api_app/api/v1/user/logout', data.user_logout)
  Mock.mock(BASE_URL + '/api_app/api/v1/user/refresh', data.refresh)
  Mock.mock(BASE_URL + '/api_app/api/v1/user/info', data.user_info)
  Mock.mock(BASE_URL + '/api_app/api/v1/user/login-sms?phone=13800000000', data.send_code)
  // shop
  Mock.mock(BASE_URL + '/api_app/api/v1/shop/position?location=40.10038,116.36867', data.shop_position)
  Mock.mock(BASE_URL + '/api_app/api/v1/shop/index-category', data.shop_index_category)
  Mock.mock(BASE_URL + '/api_app/api/v1/shop/shops?latitude=undefined&longitude=undefined', data.shops)

  // 返回goods的接口
  Mock.mock(BASE_URL + '/goods', {code: 0, data: data.goods})
  // 返回ratings的接口
  Mock.mock(BASE_URL + '/ratings', {code: 0, data: data.ratings})
  // 返回info的接口
  Mock.mock(BASE_URL + '/info', {code: 0, data: data.info})
}
// export default ???  不需要向外暴露任何数据, 只需要保存能执行即可
